refactor to a python module and add tests #32
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds tests with pytest and factors out decode and encode logic to a
sam_serve
module so that it was easier to test. It also adds a section in the README with a guide for locally testing the decoder with pytest. The modulesam_serve
is installed in each service Dockerfile from a python wheel file that needs to be generated withhatch build
. This can also be uploaded to pypi withhatch publish
The notebook example has also been updated to reflect the new handler structure. payloads to the decoder need to have a "decode_type" specified that can be any one of
"single_point" (implemented)
not implemented
"multi_point"
"bbox"
the payload should also have an input_prompt key isntead of the previous "input_point" key to reflect that the prompt can be a point, multiple foreground points, multiple foreground and multipkle background points, a bbox, etc.
we might want to change these endpoints to reflect all the variations.
I tested both gpu and cpu services locally. Would appreciate a review if you have time @Rub21 . Then we can merge in your recent work on #25